import java.util.*;


public class Primes {

public static void main(String[] args){
    int index = 0;
    int[] primesRow = new int[100];
       
    int boundary = getNumber();	
						
    for (int dividend = 2; dividend <= boundary; dividend++){
	      for (int divisor = 2; divisor <= dividend; divisor++){
	          if (dividend % divisor == 0){
		            if (dividend == divisor){
		            primesRow [index] = dividend;
		            index = index + 1;
		            } else break;
	          } else continue;
	      }
    }
		
    int[] rezultPrimesRow = Arrays.copyOf(primesRow, index);
    printResult(rezultPrimesRow);
}

    private static Integer getNumber(){
        System.out.print("Enter a number to match boundary value: ");
	      Scanner input = new Scanner(System.in);	
        int number = input.nextInt();
	      input.close();
	      return number; 
    }

    private static String printResult(int[] rowToPrint){
	      System.out.println("The row of prime numbers till the boundary value is: ");
        String result = Arrays.toString(rowToPrint);
	      System.out.println(result);
	      return result;
    }
}
